/*
 * @lc app=leetcode.cn id=929 lang=typescript
 *
 * [929] 独特的电子邮件地址
 */

// @lc code=start
function numUniqueEmails(emails: string[]): number {
    let final = new Set<string>();
    emails.forEach((i) => {
        const [local, origin] = i.split("@");
        let newLocal = "";
        for (let i = 0; i < local.length; i++) {
            const element = local[i];
            if (element === ".") continue;
            if (element === "+") break;
            newLocal += element;
        }
        final.add(newLocal + "@" + origin);
    });
    return final.size;
}
// @lc code=end
